﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlugIn.Configuration
{
    /// <summary>
    /// 组件配置集合类
    /// 作者：Zuowenjun
    /// 2016-3-30
    /// </summary>
    [ConfigurationCollection(typeof(ComponentElement))]
    public class ComponentCollection : ConfigurationElementCollection
    {

        public ComponentCollection() : base(StringComparer.OrdinalIgnoreCase)
        {

        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ComponentElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return (element as ComponentElement).FileName;
        }

        new public ComponentElement this[string fileName]
        {
            get
            {
                return (ComponentElement)base.BaseGet(fileName);
            }
        }

        public void Add(ComponentElement item)
        {
            this.BaseAdd(item);
        }

        public void Clear()
        {
            base.BaseClear();
        }

        public void Remove(string fileName)
        {
            base.BaseRemove(fileName);
        }

    }
}
